﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace POVRay {
    [PRBlock("camera")]
    public class Camera : Block {

        [PRParam()]
        [PRParamIntMap((int)CameraType.Perspective, "perspective")]
        [PRParamIntMap((int)CameraType.Orthographic, "orthographic")]
        [PRParamIntMap((int)CameraType.Fisheye, "fisheye")]
        [PRParamIntMap((int)CameraType.UltraWideAngle, "ultra_wide_angle")]
        [PRParamIntMap((int)CameraType.Omnimax, "omnimax")]
        [PRParamIntMap((int)CameraType.Panoramic, "panoramic")]
        [PRParamIntMap((int)CameraType.Spherical, "spherical")]
        [PRParamIntMap((int)CameraType.Cylinder1, "cylinder 1")]
        [PRParamIntMap((int)CameraType.Cylinder2, "cylinder 2")]
        [PRParamIntMap((int)CameraType.Cylinder3, "cylinder 3")]
        [PRParamIntMap((int)CameraType.Cylinder4, "cylinder 4")]
        public CameraType? Type { get; set; }

        [PRParam("location")]
        public Vector3 Location { get; set; }

        [PRParam("direction")]
        public Vector3? Direction { get; set; }

        [PRParam("right")]
        public Vector3? Right { get; set; }

        [PRParam("up")]
        public Vector3? Up { get; set; }

        [PRParam("sky")]
        public Vector3? Sky { get; set; }

        [PRParam()]
        public Angle2 Angle { get; set; }

        //TODO: normal{} statement

        //===== Focal Blur =====

        [PRParam("aperture")]
        public float? Aperture { get; set; }

        [PRParam("blur_samples")]
        public int? BlurSamples { get; set; }

        [PRParam("focal_point")]
        public Vector3? FocalPoint { get; set; }

        [PRParam("confidence")]
        public float? Confidence { get; set; }

        [PRParam("variance")]
        public float? Variance { get; set; }

        //===== Last =====

        [PRParam("look_at")]
        public Vector3? LookAt { get; set; }

        [PRParam()]
        public Transformation Transformation { get; set; }

        public Camera(Vector3 location) {
            Location = location;
        }

        public Camera(Vector3 location, Vector3 lookAt) {
            Location = location;
            LookAt = lookAt;
        }

        public override string ToString(int level) {
            return this.POVRayString(level);
        }
    }

    public enum CameraType {
        Perspective,
        Orthographic,
        Fisheye,
        UltraWideAngle,
        Omnimax,
        Panoramic,
        Spherical,
        Cylinder1,
        Cylinder2,
        Cylinder3,
        Cylinder4
    }
}
